package com.armani.mapper;

import com.armani.entity.ItemSku;
import com.armani.model.SkuModel;
import com.armani.model.SpuModel;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @ClassName SkuMapper
 * @Description 商品sku映射接口
 * @Author Admin
 * @Date 2021/11/27 17:48
 * @Version 1.0
 **/

public interface SkuMapper {
    List<ItemSku> pageSearch(@Param(value = "startRow") Integer startRow,
                             @Param(value = "limit")Integer limit,
                             @Param(value = "id")Integer id);

    Integer getCount(@Param(value = "id")Integer id);

    Integer insert( @Param(value = "title")String title,
                    @Param(value = "descrip")String descrip,
                    @Param(value = "spuId")Integer spuId,
                    @Param(value = "price")BigDecimal price,
                    @Param(value = "param")String param,
                    @Param(value = "inventory")Integer inventory,
                    @Param(value = "enable")Integer enable,
                    @Param(value = "creatTime") Date creatTime,
                    @Param(value = "lastTime")Date lastTime);

    Integer update(@Param(value = "id")Integer id,
                   @Param(value = "title")String title,
                   @Param(value = "descrip")String descrip,
                   @Param(value = "spuId")Integer spuId,
                   @Param(value = "price")BigDecimal price,
                   @Param(value = "param")String param,
                   @Param(value = "inventory")Integer inventory,
                   @Param(value = "enable")Integer enable,
                   @Param(value = "creatTime") Date creatTime,
                   @Param(value = "lastTime")Date lastTime);

    Integer delete(@Param(value = "id")Integer id);

    /**
     * 根据spuId查sku列表
     * @param supId 商品spu的id
     * @return sku列表集合
     */
    List<SkuModel> searchBySpuId(Integer supId);

    /**
     * 添加sku
     * @param sku 参数
     * @return 影响行
     */
    Integer insertSku(SkuModel sku);

    /**
     * 根据skuId查sku列表
     * @param skuId skuId
     * @return sku列表集合
     */
    List<SkuModel> searchBySkuId(Integer skuId);
}
